﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using SHNOPData.SHNOPModel;

namespace SHNOPData.common
{
    /// <summary>
    /// 比较修改前后的站点详细信息
    /// </summary>
    public class NTPlanDetailCompare
    {

        private static string ConvertInt2YN(int yesOrNot)
        {
            return yesOrNot == 1 ? "是" : "否";
        }
        private static string GetSingRemark(object oldStr,object newStr,string title)
        {
            string remrak = "";
            if (oldStr == null && newStr != null)
            {
                remrak = title + " ：" +" " + "修改成:" + newStr + ";";
                return remrak;
            }
            if (oldStr != null && newStr == null)
            {
                remrak = title + " ：" + oldStr + "修改成:   ";
                return remrak;
            }
            if (oldStr==null||newStr==null)
            {
                return "";
            }
         
            if (!oldStr.ToString().Equals(newStr.ToString()))
            {
                remrak = title + " ：" + oldStr + "修改成:" + newStr + ";";
                
            }
            return remrak;
        }
        #region 网规基础信息比较
        public static string CompareNTPlanBase(NTPlanBase oldNtPlanBase, NTPlanBase newNtPlanBase)
        {
            StringBuilder sb = new StringBuilder();
            string _1800PeiZhi=GetSingRemark(oldNtPlanBase._1800PeiZhi,newNtPlanBase._1800PeiZhi,"1800M配置");
            sb.Append(_1800PeiZhi);
             string _1800PlanPeiZhi=GetSingRemark(oldNtPlanBase._1800PlanPeiZhi,newNtPlanBase._1800PlanPeiZhi,"1800M规划配置");
             sb.Append(_1800PlanPeiZhi);
             string _1800PlanPort=GetSingRemark(oldNtPlanBase._1800PlanPort,newNtPlanBase._1800PlanPort,"1800M规划端口");
             sb.Append(_1800PlanPort);

             string _900PeiZhi=GetSingRemark(oldNtPlanBase._900PeiZhi,newNtPlanBase._900PeiZhi,"900M配置");
             sb.Append(_900PeiZhi);
            string _900PlanPeiZhi=GetSingRemark(oldNtPlanBase._900PlanPeiZhi,newNtPlanBase._900PlanPeiZhi,"900M规划配置");
            sb.Append(_900PlanPeiZhi);
            string _900PlanPort = GetSingRemark(oldNtPlanBase._900PlanPort, newNtPlanBase._900PlanPort, "900M规划端口");
            sb.Append(_900PlanPort);
            string belongScheme = GetSingRemark(oldNtPlanBase.belongScheme, newNtPlanBase.belongScheme, "所属方案");
            sb.Append(belongScheme);
            string channel = GetSingRemark(oldNtPlanBase.Channel, newNtPlanBase.Channel, "规划频段");
            sb.Append(channel);
            string company = GetSingRemark(oldNtPlanBase.CompanyName, newNtPlanBase.CompanyName, "公司");
            sb.Append(company);
            string deviceFacturer = GetSingRemark(oldNtPlanBase.DeviceFacturer, newNtPlanBase.DeviceFacturer, "设备厂商");
            sb.Append(deviceFacturer);
            string huanXianInfo = GetSingRemark(oldNtPlanBase.HuanXianInfo, newNtPlanBase.HuanXianInfo, "环线信息");
            sb.Append(huanXianInfo);
            string isComplaint = GetSingRemark(oldNtPlanBase.isComplaint, newNtPlanBase.isComplaint, "是否投诉");
            sb.Append(isComplaint);
            string isSameAddr = GetSingRemark(ConvertInt2YN(oldNtPlanBase.isSameAddr), ConvertInt2YN(newNtPlanBase.isSameAddr), "是否同址");
            sb.Append(isSameAddr);
            string isTiaoZheng = GetSingRemark(oldNtPlanBase.isTiaoZheng, newNtPlanBase.isTiaoZheng, "是否调整");
            sb.Append(isTiaoZheng);
            string jiaZhanAim = GetSingRemark(oldNtPlanBase.jiaZhanAim, newNtPlanBase.jiaZhanAim, "加站目的");
            sb.Append(jiaZhanAim);
            string jiaZhanProID = GetSingRemark(oldNtPlanBase.jiaZhanProID, newNtPlanBase.jiaZhanProID, "加站属性");
            sb.Append(jiaZhanProID);
            string jiaZhanType = GetSingRemark(oldNtPlanBase.JiaZhanType, newNtPlanBase.JiaZhanType, "加站类型");
            sb.Append(jiaZhanType);
            string latitude = GetSingRemark(oldNtPlanBase.latitude, newNtPlanBase.latitude, "规划纬度");
            sb.Append(latitude);
            string longitude = GetSingRemark(oldNtPlanBase.longitude, newNtPlanBase.longitude, "规划经度");
            sb.Append(longitude);
            string planPeiZhiSum = GetSingRemark(oldNtPlanBase.planPeiZhiSum, newNtPlanBase.planPeiZhiSum, "规划总配置");
            sb.Append(planPeiZhiSum);
            string planPortSum = GetSingRemark(oldNtPlanBase.planPortSum, newNtPlanBase.planPortSum, "规划总端口数");
            sb.Append(planPortSum);
            string SameAddrNum = GetSingRemark(oldNtPlanBase.PlanGuaGao, newNtPlanBase.PlanGuaGao, "规划挂高");
            sb.Append(SameAddrNum);
            string TDPeiZhi = GetSingRemark(oldNtPlanBase.TDPeiZhi, newNtPlanBase.TDPeiZhi, "TD配置");
            sb.Append(TDPeiZhi);
            string TDPlanDuanKou = GetSingRemark(oldNtPlanBase.TDPlanDuanKou, newNtPlanBase.TDPlanDuanKou, "TD规划端口");
            sb.Append(TDPlanDuanKou);
            string TDPlanPeiZhi = GetSingRemark(oldNtPlanBase.TDPlanPeiZhi, newNtPlanBase.TDPlanPeiZhi, "TD规划配置");
            sb.Append(TDPlanPeiZhi);
            string XieTongNum = GetSingRemark(oldNtPlanBase.XieTongNum, newNtPlanBase.XieTongNum, "协同平台工单号");
            sb.Append(XieTongNum);
            string TDdeviceFacturer = GetSingRemark(oldNtPlanBase.TDDeviceFacturer, newNtPlanBase.TDDeviceFacturer, "TD设备厂商");
            sb.Append(TDdeviceFacturer);
            return sb.ToString();
        }
        #endregion
        #region 站点前后比较
        public static string CompareZhanDianInfo(ZhanDianInfo oldZhanDianInfo, ZhanDianInfo newZhanDianInfo)
        {
            StringBuilder sb = new StringBuilder();
            string address = GetSingRemark(oldZhanDianInfo.address, newZhanDianInfo.address, "地址");
            sb.Append(address);
            string agreeScale = GetSingRemark(oldZhanDianInfo.agreeScale, newZhanDianInfo.agreeScale, "同意比例");
            sb.Append(agreeScale);
            string HouXuAddr = GetSingRemark(oldZhanDianInfo.HouXuAddr, newZhanDianInfo.HouXuAddr, "后续措施地址");
            sb.Append(HouXuAddr);
            string HouXuFangAn = GetSingRemark(oldZhanDianInfo.HouXuFangAn, newZhanDianInfo.HouXuFangAn, "后续措施所属方案");
            sb.Append(HouXuFangAn);
            string HouXuGuaGao = GetSingRemark(oldZhanDianInfo.HouXuGuaGao, newZhanDianInfo.HouXuGuaGao, "后续措施挂高");
            sb.Append(HouXuGuaGao);
            string HouXulatitude = GetSingRemark(oldZhanDianInfo.HouXulatitude, newZhanDianInfo.HouXulatitude, "后续措施纬度");
            sb.Append(HouXulatitude);
            string HouXulongitude = GetSingRemark(oldZhanDianInfo.HouXulongitude, newZhanDianInfo.HouXulongitude, "后续措施经度");
            sb.Append(HouXulongitude);
            string HouXuNum = GetSingRemark(oldZhanDianInfo.HouXuNum, newZhanDianInfo.HouXuNum, "后续措施编号");
            sb.Append(HouXuNum);
            string HouXuType = GetSingRemark(oldZhanDianInfo.HouXuType, newZhanDianInfo.HouXuType, "后续措施类型");
            sb.Append(HouXuType);
            string howFarToPlanning = GetSingRemark(oldZhanDianInfo.howFarToPlanning, newZhanDianInfo.howFarToPlanning, "与规划经纬度偏差距离");
            sb.Append(howFarToPlanning);
            string howFarToPlanHeight = GetSingRemark(oldZhanDianInfo.howFarToPlanHeight, newZhanDianInfo.howFarToPlanHeight, "与规划高度偏差");
            sb.Append(howFarToPlanHeight);
            string isAgree = GetSingRemark(oldZhanDianInfo.isAgree, newZhanDianInfo.isAgree, "是否同意");
            sb.Append(isAgree);

            string isFuHeZhanCha = GetSingRemark(oldZhanDianInfo.isFuHeZhanCha, newZhanDianInfo.isFuHeZhanCha, "是否符合站址偏差标准");
            sb.Append(isFuHeZhanCha);
            string isZhanDan = GetSingRemark(ConvertInt2YN(oldZhanDianInfo.isZhanDan), ConvertInt2YN(newZhanDianInfo.isZhanDan), "是否已上一站一单");
            sb.Append(isZhanDan);
            string orderNum = GetSingRemark(oldZhanDianInfo.orderNum, newZhanDianInfo.orderNum, "工单号");
            sb.Append(orderNum);
            string PhysicalSite = GetSingRemark(oldZhanDianInfo.PhysicalSite, newZhanDianInfo.PhysicalSite, "物理站点名");
            sb.Append(PhysicalSite);
            string planningDZQJiao = GetSingRemark(oldZhanDianInfo.planningDZQJiao, newZhanDianInfo.planningDZQJiao, "规划电子倾角");
            sb.Append(planningDZQJiao);
            string planningFXJiao = GetSingRemark(oldZhanDianInfo.planningFXJiao, newZhanDianInfo.planningFXJiao, "规划方向角");
            sb.Append(planningFXJiao);
            string planningJXQJiao = GetSingRemark(oldZhanDianInfo.planningJXQJiao, newZhanDianInfo.planningJXQJiao, "规划机械倾角");
            sb.Append(planningJXQJiao);
            string planningPZ = GetSingRemark(oldZhanDianInfo.planningPZ, newZhanDianInfo.planningPZ, "规划配置");
            sb.Append(planningPZ);
            string realityHeight = GetSingRemark(oldZhanDianInfo.realityHeight, newZhanDianInfo.realityHeight, "实际高度");
            sb.Append(realityHeight);
            string realityLatitude = GetSingRemark(oldZhanDianInfo.realityLatitude, newZhanDianInfo.realityLatitude, "实际纬度");
            sb.Append(realityLatitude);
            string realityLongitude = GetSingRemark(oldZhanDianInfo.realityLongitude, newZhanDianInfo.realityLongitude, "实际经度");
            sb.Append(realityLongitude);
            string ReplyContent = GetSingRemark(oldZhanDianInfo.ReplyContent, newZhanDianInfo.ReplyContent, "工单回复内容");
            sb.Append(ReplyContent);
            string ReplyDate = GetSingRemark(oldZhanDianInfo.ReplyDate, newZhanDianInfo.ReplyDate, "工单回复日期");
            sb.Append(ReplyDate);
            string ReplyMan = GetSingRemark(oldZhanDianInfo.ReplyMan, newZhanDianInfo.ReplyMan, "回复人员");
            sb.Append(ReplyMan);
       
            return sb.ToString();
        }
        #endregion
        #region 端口前后比较
        public static string ComparePortInfo(PortInfo oldPortInfo, PortInfo newPortInfo)
        {
            StringBuilder sb = new StringBuilder();

            string _1800FenpeiDate = GetSingRemark(oldPortInfo._1800FenpeiDate, newPortInfo._1800FenpeiDate, "1800M端口申请日期");
            sb.Append(_1800FenpeiDate);
            string _1800FenpeiNum = GetSingRemark(oldPortInfo._1800FenpeiNum, newPortInfo._1800FenpeiNum, "1800M站点端口分配数");
            sb.Append(_1800FenpeiNum);
            string _1800Reason = GetSingRemark(oldPortInfo._1800Reason, newPortInfo._1800Reason, "800M未完成端口分配原因");
            sb.Append(_1800Reason);
            string _1800ShenqingNum = GetSingRemark(oldPortInfo._1800ShenqingNum, newPortInfo._1800ShenqingNum, " 1800M站点申请端口数");
            sb.Append(_1800ShenqingNum);
            string _900FenpeiDate = GetSingRemark(oldPortInfo._900FenpeiDate, newPortInfo._900FenpeiDate, "900M端口申请日期");
            sb.Append(_900FenpeiDate);
            string _900FenpeiNum = GetSingRemark(oldPortInfo._900FenpeiNum, newPortInfo._900FenpeiNum, "900M站点端口分配数");
            sb.Append(_900FenpeiNum);
            string _900Reason = GetSingRemark(oldPortInfo._900Reason, newPortInfo._900Reason, "900M未完成端口分配原因");
            sb.Append(_900Reason);

            string _900ShenqingNum = GetSingRemark(oldPortInfo._900ShenqingNum, newPortInfo._900ShenqingNum, "900M站点申请端口数");
            sb.Append(_900ShenqingNum);
            string DuanKouTotalNum = GetSingRemark(oldPortInfo.DuanKouTotalNum, newPortInfo.DuanKouTotalNum, "分配端口总数");
            sb.Append(DuanKouTotalNum);
            string isFenpei = GetSingRemark(ConvertInt2YN(oldPortInfo.isFenpei),ConvertInt2YN( newPortInfo.isFenpei), "是否已分配端口");
            sb.Append(isFenpei);
            string TDFenPeiNum = GetSingRemark(oldPortInfo.TDFenPeiNum, newPortInfo.TDFenPeiNum, "TD站点端口分配数");
            sb.Append(_1800ShenqingNum);
            string TDReason = GetSingRemark(oldPortInfo.TDReason, newPortInfo.TDReason, "TD未完成端口分配原因");
            sb.Append(TDReason);
            string TDShenqingDate = GetSingRemark(oldPortInfo.TDShenqingDate, newPortInfo.TDShenqingDate, "TD端口申请日期");
            sb.Append(TDShenqingDate);
            string TDShenqingNum = GetSingRemark(oldPortInfo.TDShenqingNum, newPortInfo.TDShenqingNum, "TD站点申请端口数");
            sb.Append(TDShenqingNum);
            return sb.ToString();
        }
          #endregion
        #region 频率前后比较
        public static string ComparePinLvInfo(PinLvInfo oldPinLvInfo, PinLvInfo newPinLvInfo)
        {
            StringBuilder sb = new StringBuilder();

            string _1800Gongdan = GetSingRemark(oldPinLvInfo._1800Gongdan, newPinLvInfo._1800Gongdan, "1800M工单号");
            sb.Append(_1800Gongdan);
            string _1800GuihuaDate = GetSingRemark(oldPinLvInfo._1800GuihuaDate, newPinLvInfo._1800GuihuaDate, "1800M频率规划日期");
            sb.Append(_1800GuihuaDate);
            string _1800Reason = GetSingRemark(oldPinLvInfo._1800Reason, newPinLvInfo._1800Reason, "1800M未分配原因");
            sb.Append(_1800Reason);
            string _900Gongdan = GetSingRemark(oldPinLvInfo._900Gongdan, newPinLvInfo._900Gongdan, "900M工单号");
            sb.Append(_900Gongdan);
            string _900GuihuaDate = GetSingRemark(oldPinLvInfo._900GuihuaDate, newPinLvInfo._900GuihuaDate, "900M频率规划日期");
            sb.Append(_900GuihuaDate);
            string _900Reason = GetSingRemark(oldPinLvInfo._900Reason, newPinLvInfo._900Reason, "900M未分配原因");
            sb.Append(_900Reason);
            string is1800Fenpei = GetSingRemark(ConvertInt2YN(oldPinLvInfo.is1800Fenpei), ConvertInt2YN(newPinLvInfo.is1800Fenpei), "1800M是否频率分配");
            sb.Append(is1800Fenpei);
            string is1800Shenqing = GetSingRemark(ConvertInt2YN(oldPinLvInfo.is1800Shenqing),ConvertInt2YN(newPinLvInfo.is1800Shenqing), "1800M是否频率申请");
            sb.Append(is1800Shenqing);

            string is900Fenpei = GetSingRemark(ConvertInt2YN(oldPinLvInfo.is900Fenpei), ConvertInt2YN(newPinLvInfo.is900Fenpei), "900M是否频率分配");
            sb.Append(is900Fenpei);
            string is900Shenqing = GetSingRemark(ConvertInt2YN(oldPinLvInfo.is900Shenqing), ConvertInt2YN(newPinLvInfo.is900Shenqing), "900M是否频率申请");
            sb.Append(is900Shenqing);
            string isShenqing = GetSingRemark(ConvertInt2YN(oldPinLvInfo.isShenqing), ConvertInt2YN(newPinLvInfo.isShenqing), "是否频率申请");
            sb.Append(isShenqing);

            string isTDFenPei = GetSingRemark(ConvertInt2YN(oldPinLvInfo.isTDFenPei), ConvertInt2YN(newPinLvInfo.isTDFenPei), "TD是否频率分配");
            sb.Append(isTDFenPei);
            string isTDShengqing = GetSingRemark(ConvertInt2YN(oldPinLvInfo.isTDShengqing),ConvertInt2YN( newPinLvInfo.isTDShengqing), "TD是否频率申请");
            sb.Append(isTDShengqing);
            string TDGongdanNum = GetSingRemark(oldPinLvInfo.TDGongdanNum, newPinLvInfo.TDGongdanNum, "TD工单号");
            sb.Append(TDGongdanNum);

            string TDGuihuaDate = GetSingRemark(oldPinLvInfo.TDGuihuaDate, newPinLvInfo.TDGuihuaDate, "TD频率规划日期");
            sb.Append(TDGuihuaDate);
            string TDReason = GetSingRemark(oldPinLvInfo.TDReason, newPinLvInfo.TDReason, " TD未分配原因");
            sb.Append(TDReason);
            return "";
        }
        #endregion
        #region 入网前后比较
        public static string CompareInNetInfo(InNetInfo oldInNetInfo, InNetInfo newInNetInfo)
        {
            StringBuilder sb = new StringBuilder();

            string _1800DuanKouNum = GetSingRemark(oldInNetInfo._1800DuanKouNum, newInNetInfo._1800DuanKouNum, "1800M入网端口数");
            sb.Append(_1800DuanKouNum);

            string _1800ShenqingNum = GetSingRemark(oldInNetInfo._1800ShenqingNum, newInNetInfo._1800ShenqingNum, "1800M入网载频数");
            sb.Append(_1800ShenqingNum);

            string _900DuanKouNum = GetSingRemark(oldInNetInfo._900DuanKouNum, newInNetInfo._900DuanKouNum, "900M入网端口数");
            sb.Append(_900DuanKouNum);

            string _900ShenqingNum = GetSingRemark(oldInNetInfo._900ShenqingNum, newInNetInfo._900ShenqingNum, "900M入网载频数");
            sb.Append(_900ShenqingNum);

            string DWangName = GetSingRemark(oldInNetInfo.DWangName, newInNetInfo.DWangName, "D网站名");
            sb.Append(DWangName);

            string GWangName = GetSingRemark(oldInNetInfo.GWangName, newInNetInfo.GWangName, "G网站名");
            sb.Append(GWangName);


            string isComplete = GetSingRemark(ConvertInt2YN(oldInNetInfo.isComplete), ConvertInt2YN(newInNetInfo.isComplete), " 是否完成规划评估");
            sb.Append(isComplete);

            string isRuWang = GetSingRemark(ConvertInt2YN(oldInNetInfo.isRuWang), ConvertInt2YN(newInNetInfo.isRuWang), "  是否部分入网");
            sb.Append(isRuWang);

            string RuWangDate = GetSingRemark(oldInNetInfo.RuWangDate, newInNetInfo.RuWangDate, "物理点入网时间");
            sb.Append(RuWangDate);

            string RuWangQingKuang = GetSingRemark(oldInNetInfo.RuWangQingKuang, newInNetInfo.RuWangQingKuang, "物理点入网情况");
            sb.Append(RuWangQingKuang);

            string RuWangReason = GetSingRemark(oldInNetInfo.RuWangReason, newInNetInfo.RuWangReason, "部分入网原因");
            sb.Append(RuWangReason);
            string TDDuanKouNum = GetSingRemark(oldInNetInfo.TDDuanKouNum, newInNetInfo.TDDuanKouNum, "v");
            sb.Append(TDDuanKouNum);
            string TDPinNum = GetSingRemark(oldInNetInfo.TDPinNum, newInNetInfo.TDPinNum, "TD入网载频数");
            sb.Append(TDPinNum);

            string totalDuankouNum = GetSingRemark(oldInNetInfo.totalDuankouNum, newInNetInfo.totalDuankouNum, " 入网总端口数");
            sb.Append(totalDuankouNum);
            string totalPinNum = GetSingRemark(oldInNetInfo.totalPinNum, newInNetInfo.totalPinNum, "入网总载频数");
            sb.Append(totalPinNum);
            string TWangName = GetSingRemark(oldInNetInfo.TWangName, newInNetInfo.TWangName, "T网站名");
            sb.Append(TWangName);
            return sb.ToString();
        }
        #endregion

    }
}
